package com.fsc.mapper;

import com.fsc.entity.domain.LoginInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fsc.entity.dto.ModifyDTO;
import com.fsc.entity.dto.RegisterDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.nio.file.attribute.UserPrincipalLookupService;
import java.util.List;

/**
* @author 86183
* @description 针对表【login_info(登录信息表)】的数据库操作Mapper
* @createDate 2024-06-02 13:15:22
* @Entity com.fsc.domain.LoginInfo
*/
@Mapper
public interface LoginInfoMapper extends BaseMapper<LoginInfo> {
    @Select("SELECT * " +
            "FROM login_info " +
            "WHERE id = #{id}")
    LoginInfo selectLoginInfo(int id);

    @Update("UPDATE login_info " +
            "SET " +
            "password = #{password}, " +
            "phone = #{phone}, " +
            "icon_url = #{iconUrl}, " +
            "update_time = CURRENT_TIMESTAMP " +  // 使用数据库函数设置更新时间
            "WHERE id = #{id}")
    void updateLoginInfo(ModifyDTO modifyDTO);

    @Select("select role from login_info where id = #{loginId};")
    int getRoleById(Integer loginId);
}




